package cn.edu.scau.cmi.zenglinghong.composite.safe;

public class SafePerson extends SafeComponent{

	public SafePerson(String name, SafeComponent organization) {
		super(name, organization);
	}
	@Override
	public String doSomething() {
		System.out.println("你好，我是个人组织，不能增加成员了。");
		return "你好，我是个人组织，不能增加成员了。";
	}
	
	@Override
	public String toString(int depth) {
		String parentName = getParent() == null ? "无" : getParent().getName();
		String blank = "";
		for (int i=0; i<depth; i++) blank += " ";
		return  blank + "\"" + getName() + "\": {\n"
				+ blank + " \"类型\": \"个人\",\n"
				+ blank + " \"父亲\": \"" + parentName + "\"\n"
				+ blank + "}\n";
	}
	
	@Override
	public String toString() {
		return toString(0);
	}
}
